<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of plotLattice</title>
  <meta name="keywords" content="plotLattice">
  <meta name="description" content="Plot Lattice">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">Code</a> &gt; plotLattice.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for Code&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>plotLattice
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Plot Lattice</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function a=plotLattice(sites,varargin) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment">Plot Lattice</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="Ising2Doutput.html" class="code" title="">Ising2Doutput</a>	</li><li><a href="LatticeSimulation.html" class="code" title="function [s,cs,LL,F,Energy]=LatticeSimulation(varargin)">LatticeSimulation</a>	Lattice Simulation Model main routine</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <span class="comment">%Plot Lattice</span>
0002 <a name="_sub0" href="#_subfunctions" class="code">function a=plotLattice(sites,varargin)</a>
0003 cla
0004 D=ndims(sites);
0005 <span class="keyword">if</span> length(varargin)&lt;1
0006     vals=[-1 1];
0007     colors={<span class="string">'black'</span> <span class="string">'none'</span>};
0008 <span class="keyword">elseif</span> length(varargin)&lt;2
0009     vals=varargin{1};
0010     colors={<span class="string">'none'</span> <span class="string">'black'</span> <span class="string">'green'</span> <span class="string">'cyan'</span> <span class="string">'blue'</span> <span class="string">'magenta'</span> <span class="string">'yellow'</span> [.5 .5 .5]};
0011     <span class="keyword">if</span> length(vals)&gt;8
0012         
0013         cmap=colormap(<span class="string">'lines'</span>);
0014         <span class="keyword">for</span> i=1:length(vals)
0015             im=mod(i,64)+1;
0016             colors{i}=cmap(im,:);
0017         <span class="keyword">end</span>
0018     <span class="keyword">end</span>
0019 <span class="keyword">else</span>
0020     vals=varargin{1};
0021     colors=varargin{2};
0022 <span class="keyword">end</span>
0023 
0024 <span class="keyword">if</span> D==2
0025     [r,c]=size(sites);
0026     d=max(r,c);
0027     <span class="keyword">if</span> d&gt;60
0028        colormap([1 1 1;0 0 0;0 1 0;.5 .5 .5;0 0 1])
0029        image(sites); 
0030     <span class="keyword">else</span>
0031     msize=max(250/d,4);
0032     <span class="keyword">for</span> i=1:length(vals)
0033         [y,x]=find(sites==vals(i));
0034             y=-y;
0035 
0036         line(<span class="string">'xdata'</span>,x,<span class="string">'ydata'</span>,y,<span class="string">'markersize'</span>,msize,<span class="string">'marker'</span>,<span class="string">'o'</span>, <span class="keyword">...</span>
0037     <span class="string">'linestyle'</span>,<span class="string">'none'</span>,<span class="string">'markerfacecolor'</span>,colors{i},<span class="string">'markeredgecolor'</span>,<span class="string">'black'</span>)
0038     <span class="keyword">end</span>
0039     axis([.5 c+.5 -r-.5 -.5])
0040     axis equal
0041     <span class="keyword">end</span>
0042 <span class="keyword">end</span>
0043</pre></div>
<hr><address>Generated on Mon 21-May-2012 09:54:18 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>